<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input class="ipt1" type="text" />+
    <input class="ipt2" type="text" />
    <button>=</button>
    <input class="ipt3" type="text" />
  </body>
</html>
<script>
  var oIpt1 = document.querySelector(".ipt1"); //获取输入框1；
  var oIpt2 = document.querySelector(".ipt2"); //获取输入框2；
  var oIpt3 = document.querySelector(".ipt3"); //获取输入框3；
  var oBtn = document.querySelector("button"); //获取按钮；
  oBtn.onclick = function () {
    oIpt3.value = oIpt1.value * 1 + oIpt2.value * 1; //给按钮添加一个点击事件；
  };
</script>
